x86emul: correct FPU code/data pointers and opcode handling
authorJan Beulich <jbeulich@suse.com>
Tue, 21 Mar 2017 14:13:42 +0000 (15:13 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 21 Mar 2017 14:13:42 +0000 (15:13 +0100)
commit0711b59b858af09d06e2a4bc2725c29c8ae27989
tree91bc65e47f8c8efbbada633e84a096946a344f54
parenta8fcd80c8f02a02e5c39cd9f76b2988b270d45e7
x86emul: correct FPU code/data pointers and opcode handling

Prevent leaking the hypervisor ones (stored by hardware during stub
execution), at once making sure the guest sees correct values there.
This piggybacks on the backout logic used to deal with write faults of
FPU insns.

Deliberately ignore the NO_FPU_SEL feature here: Honoring it would
merely mean extra code with no benefit (once we XRSTOR state, the
selector values will simply be lost anyway).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com> [hvm/emulate.c]
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/tests/x86_emulator/x86_emulate.c
tools/tests/x86_emulator/x86_emulate.h
xen/arch/x86/hvm/emulate.c
xen/arch/x86/x86_emulate/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.h